<template>
  <div>
    <div class="container">
      <p class="obj-item" v-for="(value, key) in obj" :key="key">
        <span>{{ key }}: </span>
        <b>{{ value }}</b>
        <el-button class="add-btn" @click="++obj[key]"> + </el-button>
      </p>
      <el-button type="primary" @click="reset">重置</el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
import useResettableReactive from "@/hooks/useResettableReactive";
const objOrigin = {
  num1: 0,
  num2: 1,
};
const [obj, reset] = useResettableReactive(objOrigin);
</script>

<style lang="less" scoped>
.container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.obj-item {
  margin: 10px 0;
}

.add-btn {
  padding: 0;
  margin-left: 20px;
  width: 18px;
  height: 18px;
}
</style>
